GtkStyle: set style context state before calling gtk_render_icon_pixbuf()
authorCarlos Garcia Campos <cgarcia@igalia.com>
Fri, 3 Dec 2010 19:31:13 +0000 (20:31 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Sat, 4 Dec 2010 14:39:56 +0000 (15:39 +0100)
gtk/gtkstyle.c

index 83645560b509119bd2a40e9163ff6cb8ba6d72bb..ff7686a6abd52b3f4e3c70fddf8fefd7d5e03f4b 100644 (file)
@@ -1693,6 +1693,7 @@ gtk_default_render_icon (GtkStyle            *style,
 {
   GtkStyleContext *context;
   GtkStylePrivate *priv;
+  GtkStateFlags flags = 0;
   GdkPixbuf *pixbuf;
 
   if (widget)
@@ -1711,6 +1712,20 @@ gtk_default_render_icon (GtkStyle            *style,
   if (detail)
     transform_detail_string (detail, context);
 
+  switch (state)
+    {
+    case GTK_STATE_PRELIGHT:
+      flags |= GTK_STATE_FLAG_PRELIGHT;
+      break;
+    case GTK_STATE_INSENSITIVE:
+      flags |= GTK_STATE_FLAG_INSENSITIVE;
+      break;
+    default:
+      break;
+    }
+
+  gtk_style_context_set_state (context, flags);
+
   pixbuf = gtk_render_icon_pixbuf (context, source, size);
 
   gtk_style_context_restore (context);